package com.jk.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.jk.mapper.CJQMapper;
import com.jk.model.ProductBean;
import com.jk.model.WuliuBean;
import com.jk.service.CJQService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Component
public class CJQServiceImpl implements CJQService {

    @Autowired
    private CJQMapper cjqMapper;


    @Override
    public int getCount() {
        return cjqMapper.getCount();
    }

    @Override
    public Map findwuliuListt(Integer page, Integer rows, WuliuBean wuliuBean) {
        HashMap<String, Object> result = new HashMap<>();
        HashMap<String, Object> params = new HashMap<>();
        params.put("wuliuBean", wuliuBean);
        //查询count
        int count=	cjqMapper.findcount(params);
        result.put("total", count);
        //查询list
        params.put("startIndex", (page-1)*rows);
        params.put("endIndex", rows);
        List<WuliuBean> books=	cjqMapper.findBookList(params);
        result.put("rows", books);
        return result;
    }

    @Override
    public Map findwuliuListt2(Integer page, Integer rows, WuliuBean wuliuBean) {
        HashMap<String, Object> result = new HashMap<>();
        HashMap<String, Object> params = new HashMap<>();
        params.put("wuliuBean", wuliuBean);
        //查询count
        int count=	cjqMapper.findcount2(params);
        result.put("total", count);
        //查询list
        params.put("startIndex", (page-1)*rows);
        params.put("endIndex", rows);
        List<WuliuBean> books=	cjqMapper.findBookList2(params);
        result.put("rows", books);
        return result;
    }

    @Override
    public void delUserById(Integer[] ids) {
        cjqMapper.delUserById(ids);
    }

    @Override
    public void sendEmp(Integer id) {
        cjqMapper.sendEmp(id);
    }

    @Override
    public List<ProductBean> findProductListImg() {

        return cjqMapper.findProductListImg();
    }

    @Override
    public List<Map> queryProductById(Integer id) {
        List<Map> maps = cjqMapper.queryProductById(id);
        System.out.println(maps);
        return maps;
    }

    @Override
    public List<Map> queryProductById2(Integer id) {
        return cjqMapper.queryProductById2(id);
    }


}
